import { Navigate, useRoutes } from "react-router-dom";
import Home from "../views/home/index";
import Cropping from "../views/cropping/index";

// * 导入所有router
export const rootRouter = [
	{
		path: "/",
		element: <Home />
	},
	{
		path: "/home",
		element: <Home />,
		meta: {
			title: "首页",
			key: "home"
		}
	},
	{
		path: "/cropping",
		element: <Cropping />,
		meta: {
			title: "裁剪",
			key: "cropping"
		}
	},
	{
		path: "*",
		element: <Navigate to="/404" />
	},
];

const Router = () => {
	const routes = useRoutes(rootRouter);
	return routes;
};

export default Router;
